var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("UIBase"),
    s = t("TipLevelCom"),
    c = t("TipLevelCom2"),
    p = cc._decorator,
    l = p.ccclass,
    d =
        (p.property,
        p.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.viewIndex = {};
                e.tipNode = {0: {tip1: "×2", tip2: "利润翻倍"}, 1: {tip1: "+1", tip2: "增加设备"}};
                e.pathId = {
                    20021: 7022,
                    20031: 7002,
                    20032: 7002,
                    20011: 7021,
                    20012: 7022,
                    20013: 7023,
                    20201: 7024,
                    20202: 7025,
                    20203: 7026,
                    20204: 7027,
                    20205: 7028,
                    20206: 7029,
                    20161: 7900,
                    20162: 7900
                };
                e.addTipCom2Tip = {
                    20012: {key: "20012", tip1: "40509", tip2: "20m", icon: "7022"},
                    20013: {key: "20013", tip1: "40510", tip2: "5m", icon: "7023"}
                };
                return e;
            }
            e.prototype.onShowEnd = function () {
                EVUIEffView.on(EVUIEffView.addTipCom, this.addNext.bind(this), this);
                EVUIEffView.on(EVUIEffView.addTipCom2, this.addNext2.bind(this), this);
                EVUIEffView.on(EVUIEffView.movePropSpriteIcon, this.movePropSpriteIcon.bind(this), this);
            };
            e.prototype.movePropSpriteIcon = function (t, e, o, a, i, n, r) {
                void 0 === i && (i = !1);
                void 0 === r && (r = 1.2);
                PlayEffectDo.playSpriteMoveTo(
                    0,
                    this.node,
                    e,
                    o,
                    QLooperNode.tag_PlaySprite,
                    i ? a : this.pathId[a],
                    n,
                    r
                );
            };
            e.prototype.addNext = function (t, e) {
                this.tipNode[e] && this.parseNextDlg(this.tipNode[e]);
            };
            e.prototype.addNext2 = function (t, e) {
                this.addTipCom2Tip[e] && this.parseNext2Dlg(this.addTipCom2Tip[e]);
            };
            e.prototype.parseNext2Dlg = function (t) {
                var e = this.getNextNullIndex();
                if (!this.viewIndex[e]) {
                    var o = QLooperNode.getNode(QLooperNode.tag_tipLevelCom2);
                    o.parent = this._list;
                    o.zIndex = e;
                    o.setPosition(CacheDataManager.dlgPos.add(cc.v2(0, e * o.height - 90)));
                    var a = o.getComponent(c.default);
                    this.viewIndex[e] = a;
                    a.play(e, t, this.clearNode.bind(this));
                }
            };
            e.prototype.parseNextDlg = function (t) {
                var e = this.getNextNullIndex();
                if (!this.viewIndex[e]) {
                    var o = QLooperNode.getNode(QLooperNode.tag_tipDlg);
                    o.parent = this._list;
                    o.zIndex = e;
                    o.setPosition(CacheDataManager.dlgPos.add(cc.v2(0, e * o.height - 50)));
                    var a = o.getComponent(s.default);
                    this.viewIndex[e] = a;
                    a.play(e, t, this.clearNode.bind(this));
                }
            };
            e.prototype.clearNode = function (t) {
                if (this.viewIndex[t]) {
                    QLooperNode.putNode(this.viewIndex[t].node);
                    delete this.viewIndex[t];
                }
            };
            e.prototype.getNextNullIndex = function () {
                for (var t = 0; this.viewIndex[t]; ) t++;
                return t;
            };
            e.prototype.onCloseStart = function () {
                EVUIEffView.offTarget(this);
                for (var t in this.viewIndex)
                    if (this.viewIndex[t]) {
                        var e = this.viewIndex[t].getComponent(s.default);
                        e ? e.clear() : (e = this.viewIndex[t].getComponent(c.default)) && e.clear();
                        QLooperNode.putNode(this.viewIndex[t].node);
                    }
            };
            return n([l], e);
        })(r.default));
o.default = d;
